<?php

declare(strict_types=1);

namespace App\Info\Model;

use Mine\MineModel;

/**
 * @property int $id ID
 * @property string $title 标题
 * @property string $img_title 图片标题
 * @property string $sub_title 副标题
 * @property string $summary 摘要
 * @property string $thumb 缩略图
 * @property string $tag_list 标题列表
 * @property string $one_img 第一区图
 * @property string $one_header 第一区块头
 * @property string $one_block 第一区块
 * @property string $two_header 二区块头
 * @property string $two_block 第二区块
 * @property string $two_img 第二区块图
 * @property int $create_time 
 * @property int $update_time 
 */
class InfoCompany extends MineModel
{
    protected ?string $dateFormat = 'U';
    const CREATED_AT = 'create_time';
    const UPDATED_AT = 'update_time';
    /**
     * The table associated with the model.
     */
    protected ?string $table = 'info_company';

    /**
     * The attributes that are mass assignable.
     */
    protected array $fillable = ['id', 'title', 'img_title', 'sub_title', 'summary', 'thumb', 'tag_list', 'one_img', 'one_header', 'one_block', 'two_header', 'two_block', 'two_img', 'create_time', 'update_time'];

    /**
     * The attributes that should be cast to native types.
     */
    protected array $casts = ['id' => 'integer', 'create_time' => 'integer', 'update_time' => 'integer'];

    public function setOneImgAttribute($value)
    {
        $this->attributes['one_img'] = empty($value) ? 0 : json_encode($value);
    }
    public function getOneImgAttribute($value)
    {
        return empty($value) ? []: json_decode($value,true);
    }

    public function setOneHeaderAttribute($value)
    {
        $this->attributes['one_header'] = empty($value) ? 0 : json_encode($value);
    }
    public function getOneHeaderAttribute($value)
    {
        return empty($value) ? []: json_decode($value,true);
    }


    public function setOneBlockAttribute($value)
    {
        $this->attributes['one_block'] = empty($value) ? 0 : json_encode($value);
    }
    public function getOneBlockAttribute($value)
    {
        return empty($value) ? []: json_decode($value,true);
    }
    


    public function setTwoHeaderAttribute($value)
    {
        $this->attributes['two_header'] = empty($value) ? 0 : json_encode($value);
    }
    public function getTwoHeaderAttribute($value)
    {
        return empty($value) ? []: json_decode($value,true);
    }

    public function setTwoBlockAttribute($value)
    {
        $this->attributes['two_block'] = empty($value) ? 0 : json_encode($value);
    }
    public function getTwoBlockAttribute($value)
    {
        return empty($value) ? []: json_decode($value,true);
    }
    public function setTwoImgAttribute($value)
    {
        $this->attributes['two_img'] = empty($value) ? 0 : json_encode($value);
    }
    public function getTwoImgAttribute($value)
    {
        return empty($value) ? []: json_decode($value,true);
    }
    
    
}
